import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";

// https://vite.dev/config/
export default defineConfig({
  plugins: [react()],

  server: {
    port: 3000, // 设置开发服务器的端口号
    host: "0.0.0.0", // 设置开发服务器的主机地址
    proxy: {
      "/api": {
        target: "http://127.0.0.1:8000/api/",
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ""),
      },
    },
  },

  css: {
    preprocessorOptions: {
      less: {
        javascriptEnabled: true,
        modifyVars: {
          "primary-color": "#1890ff",
        },
        // 支持内联 JavaScript
        math: "always",
      },
    },
  },
});
